package com.test.springboot3.springboot3testdemo1.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/8/6-下午3:57
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Configuration
public class RabbitMqConfig {
  @Bean
  public Queue testDirectQueue() {
    return new Queue("test-direct-queue");
  }

  @Bean
  public DirectExchange testDirectExchange() {
    return new DirectExchange("test-direct-exchange");
  }

  @Bean
  public Binding bindDirect() {
    return BindingBuilder.bind(testDirectQueue())
        .to(testDirectExchange())
        .with("test-direct-routing-key");
  }
}
